package com.anolesoft.yr.store.stk.service.impl;

import com.anolesoft.yr.store.stk.dto.StkMainDTO;
import com.anolesoft.yr.util.CustomBeanUtils;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.anolesoft.yr.store.stk.entity.StkMainExample;
import java.util.List;
import java.util.stream.Collectors;

import com.anolesoft.yr.store.stk.dao.StkMainDao;
import com.anolesoft.yr.store.stk.entity.StkMain;
import com.anolesoft.yr.store.stk.service.StkMainService;
@Service
public class StkMainServiceImpl extends ServiceImpl<StkMainDao, StkMain> implements StkMainService{
    @Autowired
    private StkMainDao stkMainDao;
    @Override
    public long countByExample(StkMainExample example) {
        return baseMapper.countByExample(example);
    }
    @Override
    public int deleteByExample(StkMainExample example) {
        return baseMapper.deleteByExample(example);
    }
    @Override
    public List<StkMain> selectByExample(StkMainExample example) {
        return baseMapper.selectByExample(example);
    }
    @Override
    public int updateByExampleSelective(StkMain record,StkMainExample example) {
        return baseMapper.updateByExampleSelective(record,example);
    }
    @Override
    public int updateByExample(StkMain record,StkMainExample example) {
        return baseMapper.updateByExample(record,example);
    }
    @Override
    public int updateBatch(List<StkMain> list) {
        return baseMapper.updateBatch(list);
    }
    @Override
    public int updateBatchSelective(List<StkMain> list) {
        return baseMapper.updateBatchSelective(list);
    }
    @Override
    public int batchInsert(List<StkMain> list) {
        return baseMapper.batchInsert(list);
    }
    @Override
    public int insertOrUpdate(StkMain record) {
        return baseMapper.insertOrUpdate(record);
    }
    @Override
    public int insertOrUpdateSelective(StkMain record) {
        return baseMapper.insertOrUpdateSelective(record);
    }

    @Override
    public <E extends IPage<StkMain>> List<StkMainDTO> pageUnion(E page, Wrapper<StkMain> queryWrapper) {
        List<StkMain> stkMains = stkMainDao.selectByWrapperPage(page, queryWrapper);
//        return page;
        return stkMains.stream().map(CustomBeanUtils::stkMainDO2DTO).collect(Collectors.toList());
    }
}
